package edu.wtbu.cs.androiddemo.activity.list;

import android.os.Bundle;
import android.view.View;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.recyclerview.widget.RecyclerView;

import edu.wtbu.cs.androiddemo.R;
import edu.wtbu.cs.androiddemo.layout.OnViewPagerListener;
import edu.wtbu.cs.androiddemo.layout.ViewPagerLayoutManager;

public class VideoListDemoActivity extends AppCompatActivity {

    RecyclerView recyclerView;

    private ViewPagerLayoutManager viewPagerLayoutManager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_video_list_demo);
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            return insets;
        });
        recyclerView = findViewById(R.id.recyclerview);
        recyclerView.setLayoutManager(viewPagerLayoutManager);
//        recyclerView.scrollToPosition(PlayListActivity.initPos);
//
//        viewPagerLayoutManager.setOnViewPagerListener(new OnViewPagerListener() {
//            @Override
//            public void onInitComplete() {
//                playCurVideo(PlayListActivity.initPos);
//            }
//
//            @Override
//            public void onPageRelease(boolean isNext, int position) {
//                if (ivCurCover != null) {
//                    ivCurCover.setVisibility(View.VISIBLE);
//                }
//            }
//
//            @Override
//            public void onPageSelected(int position, boolean isBottom) {
//                playCurVideo(position);
//            }
//        });
    }
}